note: may be broken with “dark theme” setting on chrome for android
i’ve been reading the excellent Web Browser Engineering and following along in rust. you can too! the whole book is free online!
so far i’ve done a rudimentary html parser, dom tree, layout tree, and paint, with only ~2000 lines of code. now i’m working on a toy css engine.
i’ve been reading the excellent Web Browser Engineering and following along in rust. you can too! the whole book is free online!
so far i’ve done a rudimentary html parser, dom tree, layout tree, and paint, with only ~2000 lines of code. now i’m working on a toy css engine.
this counts as css crimes right? ^.^;;
https://www.youtube.com/watch?v=qWTHxQWUreo
live demo (chromium-based browsers only for now)
cohost only supports inline styles, hence the need for tooling like prechoster, but code reuse is still possible thanks to the ‘all’ and ‘display’ properties. this can make hand-writing chosts easier, and it could potentially even help reduce the size of generated chosts? here’s how:
<div style="/* common */; display: contents;">
/* common */
in that wrapper elementall: inherit; display: /* something */;
to each of their stylesthese wrappers can be nested, though for inner wrappers you can use <div style="all: inherit; /* common */">
to save a few characters. for example:
<div style="position: relative; height: 8em;">
<div style="width: 2em; height: 2em; position: absolute; justify-content: center; color: #fff9f2; background: #83254f; display: contents;">
<div style="all: inherit; display: flex; inset: 1em 0 0 1em;">e</div>
<div style="all: inherit; display: flex; inset: 3em 0 0 3em;">g</div>
<div style="all: inherit; display: flex; inset: 5em 0 0 5em;">g</div>
<div style="all: inherit; background: #e56b6f;">
<div style="all: inherit; display: flex; inset: 1em 0 0 4em;">b</div>
<div style="all: inherit; display: flex; inset: 3em 0 0 6em;">u</div>
<div style="all: inherit; display: flex; inset: 5em 0 0 8em;">g</div>
</div>
</div>
</div>
(see also: github testing that i did for my profile readme)
data:image/svg+xml,<?xml version="1.0" encoding="UTF-8"?><svg width="99" height="99" viewBox="0 0 1 1" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="1" height="1" fill="green"/></svg>
supported
all: inherit;
)stripped (into its textContent if any)